<% title_tag t(".Account Settings") %>

<div class="flex-wrap">
  <div class="aside-wrap">
    <%= render "/users/sidebar" %>
  </div>
  <div class="main-wrap">
    <div class="main-content">
      <h1 class="title"><%= t(".Account") %></h1>
      <div class="sub-title"><h2><%= t(".Change password") %><h2></div>
      <%= form_for(@user, url: account_settings_path, html: { method: :put, id: "account-change-password", class: "mb-section" }) do |f| %>
        <input type="hidden" name="_by" value="password" />

        <%= form_group(f, :current_password, class: "form-group mb-button") do %>
          <%= f.password_field :current_password, class: "form-control", autocomplete: "current-password" %>
          <div class="form-text">
            <%= t(".We need your current password to confirm your changes")  %>
          </div>
        <% end %>

        <%= form_group(f, :password) do %>
          <%= f.password_field :password, class: "form-control", autocomplete: "new-password" %>
        <% end %>

        <%= form_group(f, :password_confirmation, class: 'mb-button') do %>
          <%= f.password_field :password_confirmation, class: "form-control", autocomplete: "new-password" %>
        <% end %>

        <div class="form-group">
          <%= f.submit t(".Update password"), class: "btn btn-primary btn-submit"%>
        </div>
      <% end %>

      <%= form_for(@user, url: account_settings_path, html: { method: :put, id: "account-change-username", class: "mb-section" }) do |f| %>
        <div class="sub-title"><h2><%= t(".Change username") %><h2></div>
        <input type="hidden" name="_by" value="username" />

        <%= form_group(f, :slug, label: false) do %>
          <p><%= t(".Unless you really need it, we recommended that you do not change your username") %></p>
          <div class="input-group input-button-group">
            <%= f.text_field :slug, class: "form-control", autocomplete: "username" %>
            <%= f.submit t(".Update"), class: "btn" %>
          </div>
        <% end %>
      <% end %>

      <div class="sub-title"><h2><%= t(".Danger zone") %><h2></div>
      <div class="form-group mb-button">
        <div class="text-main" style="font-size: 15px">
          <%= t(".Delete my account") %>
        </div>
        <div class="form-text">
          <%= t(".Once you delete your account, there is no going back") %>
        </div>
      </div>
      <%= button_to t(".Delete my account"), account_settings_path, class: "btn btn-danger btn-submit", data: { confirm: t(".Are you sure?") }, method: :delete %>
    </div>
  </div>
</div>

